package com.acme.bankapp.domain.bank;

import java.util.Date;

import com.acme.bankapp.listeners.ClientRegistrationListener;
import com.acme.bankapp.listeners.EmailNotificationListener;
import com.acme.bankapp.listeners.PrintClientListener;

public class Bank {
	private int i;
	private Client masclient[] = new Client[10];
	private DebugListener deb;
	private ClientRegistrationListener listener[] = {
			new PrintClientListener(), new EmailNotificationListener() };

	public void addclient(Client cl) {
		masclient[i] = cl;
		i++;
		deb.onClientAdded(cl);
	}

	class DebugListener implements ClientRegistrationListener {

		@Override
		public void onClientAdded(Client c) {
			for (ClientRegistrationListener creg : listener) {
				creg.onClientAdded(c);
			}
			Date dat = new Date();
			System.out.println(dat);
		}

	}

	public Client[] getClients() {
		return masclient;
	}

	public Client getClient(int i) {
		return masclient[i];
	}

	public Bank() {
		deb = new DebugListener();
	}
}
